<?php
/* @var $this QuotationOrderHeaderController */
/* @var $model QuotationOrderHeader */

$this->breadcrumbs=array(
	'Quotation Order Headers'=>array('index'),
	$model->quotation_no,
);

$this->menu=array(
	array('label'=>'List Quotation', 'url'=>array('quotationOrderHeader/index')),
	array('label'=>'View Quotation', 'url'=>array('quotationOrderHeader/viewQuotationOrderHeader','id'=>$model->quotation_no)),
	//array('label'=>'Add Item', 'url'=>array('create','quo_no'=>$model->quotation_no)),
	array('label'=>'Update Item', 'url'=>array('update', 'id'=>$model->detail_id)),
	array('label'=>'Delete Items', 'url'=>'#', 'linkOptions'=>array('submit'=>array('delete', 'id'=>$model->detail_id),'confirm'=>'Are you sure you want to delete this item?')),
);
?>

<h1>View Quotation item # <?php echo $model->product_pn; ?></h1>

<?php $this->widget('zii.widgets.CDetailView', array(
	'data'=>$model,
	'attributes'=>array(
		'product_pn',
		'additional',
		array(
			'name'=>'qty',
			'value'=>$model->qty.' pc(s)',
		),
		'uom',
		array(//quotationNo
			'name'=>'unit_sell',
			'value'=>number_format($model->unit_sell,2,'.',','),
         ),
		array(
			'name'=>'products.total',
			'value'=>number_format($model->unit_sell*$model->qty,2,'.',','),
         ),
		/*
		array(//quotationNo
			'name'=>'products.unit_sell',
			'value'=>number_format($model->products->unit_sell*FormatingNumber::currency($model->quotationNo->currency),2,'.',','),
         ),
		 array(
			'name'=>'products.total',
			'value'=>number_format($model->products->unit_sell*$model->qty*FormatingNumber::currency($model->quotationNo->currency),2,'.',','),
         ),*/
	),
)); ?>

<table width="200px">
	<tr>
		<td>
<?php
		$fromStep=Yii::app()->session['fromStep'];
		
		if($model->quotationNo->generate==0){
			echo CHtml::beginForm( Yii::app()->createUrl('QuotationOrderDetail/create&quo_no='.$model->quotation_no));
?>
			<input type='submit' value='Add Item' style="margin-left:20px;">
<?php 		echo CHtml::endForm(); 
		}
?>
		</td>
		<td>
<?php
		if(isset($fromStep)){
			echo CHtml::beginForm( Yii::app()->createUrl('QuotationOrderHeader/viewQuotationOrderHeader&id='.$model->quotation_no));
			echo CHtml::submitButton('FINISH');
			echo CHtml::endForm(); 
		}
?>
		</td>
	</tr>
</table>